function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
import "antd/es/empty/style";
import _Empty from "antd/es/empty";
import "antd/es/timeline/style";
import _Timeline from "antd/es/timeline";
var _excluded = ["className", "title"];
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from 'react';
import classnames from 'classnames';
import Panel from "../Panel";
import "./index.less";
import p2 from "./imgs/p2.png";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export default (function (props) {
  var _props$items = props.items,
    items = _props$items === void 0 ? [] : _props$items,
    panelProps = props.panelProps;
  var _ref = panelProps || {},
    className = _ref.className,
    _ref$title = _ref.title,
    title = _ref$title === void 0 ? '流程信息' : _ref$title,
    restPanelProps = _objectWithoutProperties(_ref, _excluded);
  return /*#__PURE__*/_jsx(Panel, _objectSpread(_objectSpread({
    className: classnames('pd-approval-flow', className),
    title: title
  }, restPanelProps), {}, {
    children: /*#__PURE__*/_jsx(_Timeline, {
      children: items.length > 0 ? items.map(function (item, index) {
        var _items, _item$avatar, _item$futureHandleNam, _item$futureHandleNam2, _item$futureHandleNam3, _item$futureHandleNam4, _item$renderExtraCont;
        return /*#__PURE__*/_jsxs(_Timeline.Item, {
          className: classnames({
            'pd-approval-flow-not-activate': !((_items = items[index + 1]) !== null && _items !== void 0 && _items.avatar)
          }),
          dot: typeof item.avatar === 'string' ? /*#__PURE__*/_jsx("div", {
            className: "pd-approval-flow-txt-avatar",
            title: item.avatar,
            children: (_item$avatar = item.avatar) === null || _item$avatar === void 0 ? void 0 : _item$avatar.slice(-2)
          }) : item.avatar || /*#__PURE__*/_jsx("img", {
            src: p2,
            className: "pd-approval-flow-avatar",
            style: {
              width: 30,
              height: 30,
              borderRadius: '50%'
            }
          }),
          children: [/*#__PURE__*/_jsxs("div", {
            className: "pd-approval-flow-title",
            children: [/*#__PURE__*/_jsx("span", {
              style: {
                color: item.avatar ? '#323233' : '#666'
              },
              children: item.name
            }), item.tags, /*#__PURE__*/_jsx("span", {
              className: "pd-approval-flow-time",
              children: item.extra
            })]
          }), !item.avatar && /*#__PURE__*/_jsxs("div", {
            className: "pd-approval-flow-person",
            title: (_item$futureHandleNam = item.futureHandleNames) === null || _item$futureHandleNam === void 0 ? void 0 : _item$futureHandleNam.join('、'),
            children: [(_item$futureHandleNam2 = item.futureHandleNames) === null || _item$futureHandleNam2 === void 0 ? void 0 : (_item$futureHandleNam3 = _item$futureHandleNam2.slice(0, 3)) === null || _item$futureHandleNam3 === void 0 ? void 0 : _item$futureHandleNam3.join('、'), (((_item$futureHandleNam4 = item.futureHandleNames) === null || _item$futureHandleNam4 === void 0 ? void 0 : _item$futureHandleNam4.length) || 0) > 3 && '...']
          }), /*#__PURE__*/_jsx("div", {
            className: "pd-approval-flow-desc",
            style: {
              background: item.content ? '#F7F8FA' : '#fff'
            },
            children: /*#__PURE__*/_jsx("div", {
              children: item.content
            })
          }), (item === null || item === void 0 ? void 0 : (_item$renderExtraCont = item.renderExtraContent) === null || _item$renderExtraCont === void 0 ? void 0 : _item$renderExtraCont.call(item)) && /*#__PURE__*/_jsx("div", {
            className: "pd-approval-flow-extra-content",
            children: item === null || item === void 0 ? void 0 : item.renderExtraContent()
          })]
        }, index);
      }) : /*#__PURE__*/_jsx(_Empty, {
        image: _Empty.PRESENTED_IMAGE_SIMPLE
      })
    })
  }));
});